<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MPI_Testsome</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="MPI_Testsome"><H1>MPI_Testsome</H1></A>
Tests for some given requests to complete 
<H2>Synopsis</H2>
<PRE>
int MPI_Testsome(int incount, MPI_Request array_of_requests[], int *outcount, 
                int array_of_indices[], MPI_Status array_of_statuses[])
</PRE>
<H2>Input Parameters</H2>
<DL>
<DT><B>incount </B><DD>length of array_of_requests (integer) 

<DT><B>array_of_requests </B><DD>array of requests (array of handles) 
</DL>
<P>
<H2>Output Parameters</H2>
<DL>
<DT><B>outcount </B><DD>number of completed requests (integer) 

<DT><B>array_of_indices </B><DD>array of indices of operations that 
completed (array of integers) 

<DT><B>array_of_statuses </B><DD>array of status objects for 
operations that completed (array of Status).  May be <TT>MPI_STATUSES_IGNORE</TT>.
</DL>
<P>
<H2>Notes</H2>
<P>
While it is possible to list a request handle more than once in the
<TT>array_of_requests</TT>, such an action is considered erroneous and may cause the
program to unexecpectedly terminate or produce incorrect results.
<P>
<H2>Thread and Interrupt Safety</H2>
<P>
This routine is thread-safe.  This means that this routine may be
safely used by multiple threads without the need for any user-provided
thread locks.  However, the routine is not interrupt safe.  Typically,
this is due to the use of memory allocation routines such as <TT>malloc
</TT>or other non-MPICH runtime routines that are themselves not interrupt-safe.
<P>
<H2>Notes on the MPI_Status argument</H2>
<P>
The <TT>MPI_ERROR</TT> field of the status return is only set if
the return from the MPI routine is <TT>MPI_ERR_IN_STATUS</TT>.  That error class
is only returned by the routines that take an array of status arguments
(<TT>MPI_Testall</TT>, <TT>MPI_Testsome</TT>, <TT>MPI_Waitall</TT>, and <TT>MPI_Waitsome</TT>).  In
all other cases, the value of the <TT>MPI_ERROR</TT> field in the status is
unchanged.  See section 3.2.5 in the MPI-1.1 specification for the
exact text.
<P>
For send operations, the only use of status is for <TT>MPI_Test_cancelled</TT> or
in the case that there is an error in one of the four routines that
may return the error class <TT>MPI_ERR_IN_STATUS</TT>, in which case the
<TT>MPI_ERROR</TT> field of status will be set.  In that case, the value
will be set to <TT>MPI_SUCCESS</TT> for any send or receive operation that completed
successfully, or <TT>MPI_ERR_PENDING</TT> for any operation which has neither
failed nor completed.
<P>
<H2>Notes for Fortran</H2>
All MPI routines in Fortran (except for <TT>MPI_WTIME</TT> and <TT>MPI_WTICK</TT>) have
an additional argument <TT>ierr</TT> at the end of the argument list.  <TT>ierr
</TT>is an integer and has the same meaning as the return value of the routine
in C.  In Fortran, MPI routines are subroutines, and are invoked with the
<TT>call</TT> statement.
<P>
All MPI objects (e.g., <TT>MPI_Datatype</TT>, <TT>MPI_Comm</TT>) are of type <TT>INTEGER
</TT>in Fortran.
<P>
<H2>Errors</H2>
<P>
All MPI routines (except <TT>MPI_Wtime</TT> and <TT>MPI_Wtick</TT>) return an error value;
C routines as the value of the function and Fortran routines in the last
argument.  Before the value is returned, the current MPI error handler is
called.  By default, this error handler aborts the MPI job.  The error handler
may be changed with <TT>MPI_Comm_set_errhandler</TT> (for communicators),
<TT>MPI_File_set_errhandler</TT> (for files), and <TT>MPI_Win_set_errhandler</TT> (for
RMA windows).  The MPI-1 routine <TT>MPI_Errhandler_set</TT> may be used but
its use is deprecated.  The predefined error handler
<TT>MPI_ERRORS_RETURN</TT> may be used to cause error values to be returned.
Note that MPI does <EM>not</EM> guarentee that an MPI program can continue past
an error; however, MPI implementations will attempt to continue whenever
possible.
<P>
<DL><DT><B>MPI_SUCCESS </B> <DD> No error; MPI routine completed successfully.
</DL>
<DL><DT><B>MPI_ERR_IN_STATUS </B> <DD> The actual error value is in the <TT>MPI_Status</TT> argument.
This error class is returned only from the multiple-completion routines
(<TT>MPI_Testall</TT>, <TT>MPI_Testany</TT>, <TT>MPI_Testsome</TT>, <TT>MPI_Waitall</TT>, <TT>MPI_Waitany</TT>,
and <TT>MPI_Waitsome</TT>).  The field <TT>MPI_ERROR</TT> in the status argument
contains the error value or <TT>MPI_SUCCESS</TT> (no error and complete) or
<TT>MPI_ERR_PENDING</TT> to indicate that the request has not completed.
</DL>
The MPI Standard does not specify what the result of the multiple
completion routines is when an error occurs.  For example, in an
<TT>MPI_WAITALL</TT>, does the routine wait for all requests to either fail or
complete, or does it return immediately (with the MPI definition of
immediately, which means independent of actions of other MPI processes)?
MPICH has chosen to make the return immediate (alternately, local in MPI
terms), and to use the error class <TT>MPI_ERR_PENDING</TT> (introduced in MPI 1.1)
to indicate which requests have not completed.  In most cases, only
one request with an error will be detected in each call to an MPI routine
that tests multiple requests.  The requests that have not been processed
(because an error occured in one of the requests) will have their
<TT>MPI_ERROR</TT> field marked with <TT>MPI_ERR_PENDING</TT>.
<P>
<P><B>Location:</B>testsome.c<P>
</BODY></HTML>
